class ErrorCategory:
    INPUT = "I"  # 输入错误 400-499
    AUTH = "A"  # 认证错误 401,403
    Permission = "P"  # 权限错误 403
    Resource = "R"  # 资源不存在 404
    DATA = "D"  # 数据错误 400,409
    Limit = "L"  # 限流错误 429
    Third = "T"  # 第三方服务错误 	502
    Server = "S"  # 服务错误 500-599


# 通用错误 (00)
class CommonErrors:
    INVALID_JSON = "I00001"  # 无效的JSON格式
    MISSING_PARAM = "I00002"  # 缺少必要参数
    ILLEGAL_TIME = "I00003"  # 时间非法
    INVALID_PARAMETER = "I00004"  # 传入参数无效
    RATE_LIMIT = "L00001"  # 请求过于频繁
    VERSION_CONFLICT = "D00001"  # 版本冲突
    RESOURCE_NOT_FOUND = "R00001"  # 通用资源不存在


# 用户模块 (01)
class UserErrors:
    USER_NOT_FOUND = "R01001"  # 用户不存在
    USER_ALREADY_EXISTS = "D01002"  # 手机号重复
    INVALID_ROLE_VALUE = "I01001"  # 非法的角色值异常


# 订单模块 (02)
class OrderErrors:
    OUT_OF_STOCK = "D02001"  # 库存不足
    ORDER_EXPIRED = "D02002"  # 订单已过期


# 认证模块 (03)
class AuthErrors:
    INVALID_TOKEN = "A03001"  # 无效令牌
    TOKEN_EXPIRED = "A03002"  # 令牌过期
    WRONG_CAPTCHA = "I03003"  # 验证码错误
    LOGIN_FAILED = "A03004"  # 用户名或密码错误
    MISSING_AUTHORIZATION_HEADER = "A03005"
    PERMISSION_DENIED = "P03001"  # 权限不足


# 工作日志模块 (04)
class WorkLogErrors:
    WORK_LOG_NOT_FOUND = "R04001"  # 日志不存在
    INVALID_UPDATE_FIELD = "I04001"  # 传入更新字段无效


# 内部服务模块 (99)
class InternalErrors:
    INTERNAL_ERROR = "S99001"  # 服务器错误
    EXPORT_FAILED = "S99002"  # 导出表失败
    CONFIG_NOT_FOUND = "R99001"  # 配置不存在
    CONFIG_LOAD_FAILED = "D99001"  # 配置加载失败
    INVALID_CONFIG = "D99002"  # 配置信息有误
